<?php
namespace wogu2\mvc\result\http;

use wogu2\mvc\result\AbstractResult;
use wogu2\view\http\Smarty as View;

class Smarty extends AbstractResult
{
    private $_view = null;
    
    public function execute($resultConfig) {
        $smartyConfig = $this->_runtime->smartyConfig;
        $this->_view = new View();
        $this->_view->init(array(
            'classPath' => $smartyConfig['classPath'],
            'templatesDir' => $this->_request->getRealPath($smartyConfig['templatesDir']),
            'templatesCacheDir' => $this->_request->getRealPath($smartyConfig['templatesCacheDir'])
        ));
        $this->_view->assign('runtime', $this->_runtime);
        $this->_view->assign('valueStack', $this->_runtime->valueStack);
        $this->appendBody($this->_view->fetch($resultConfig['location']));
    }
}